<?php
// +----------------------------------------------------------------------
// | EtrolPHP [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Author: LJQ <245369209@qq.com> 
// +----------------------------------------------------------------------

namespace app\basic\model;
use app\common\model\Base;

/**
 * 救援队伍
 */
class Rescue extends Base{

	protected $name = "rescueunit";
	protected $createTime = 'createTime';
	protected $updateTime = 'updateTime';
    protected $category = 1;
	protected $auto = ['categoryId'];
	
	public function  setCategoryIdAttr(){
		return $this->category;
	}
	
	public function getResuceUnitType(){
		$where['sysCode'] = 15;
		if($this->category){
			$where['parentSubsystemNo'] = $this->category;
		}
		$rescueUnitType = db('basicinfo')->where($where)->column('subsystemName','subsystemNo');
		return $rescueUnitType;
	}
	
	public function getTypeIdAttr($value,$data){
		$rescueUnitType = $this->getResuceUnitType();
		if($data['typeId']){
			return $rescueUnitType[$data['typeId']];
		}else{
			return null;
		}
	}
	

}